package org.alex.samples.model;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name="exam_user_role")
public class ExamUserRole implements Serializable{
	
	private static final long serialVersionUID = 1L;
	
	@Id
	@Column(name = "role_id")
	private Integer roleId;
	
	@Id
	@Column(name = "user_id",unique=true)
	private String userId;
	
	@OneToOne
	@JoinColumn(name = "user_id")
	private User userRole;  


	@ManyToOne(cascade = {CascadeType.DETACH, CascadeType.PERSIST, CascadeType.MERGE})
	@JoinColumn(name="role_id")
	private ExamRole role;
	
	public ExamUserRole() {

	}

	public Integer getRoleId() {
		return roleId;
	}

	public void setRoleId(Integer roleId) {
		this.roleId = roleId;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}
	
	

}
